package com.smart.manager.union.egg.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.smart.common.entities.ajax.AjaxResult;
import com.smart.common.entities.constant.SmartConstant;
import com.smart.common.entities.core.Page;
import com.smart.manager.union.egg.body.RUnionEggOrder;
import com.smart.manager.union.egg.models.UnionEggOrder;
import com.smart.manager.union.egg.repository.UnionEggOrderRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 狼山鸡蛋兑换规格
 *
 * @author Administrator
 */
@Api(tags = "狼山鸡蛋订单")
@RestController
@RequestMapping(SmartConstant.MANAGER_API_PREFIX + "union/egg/order")
@RequiredArgsConstructor


public class UnionEggOrderApi {

    private final UnionEggOrderRepository repository;

    @GetMapping(value = "pageList")
    @ApiOperation(value = "查询订单")
    @SaCheckPermission("union:egg:order:pageList")
    public AjaxResult<Page<UnionEggOrder>> pageList(@Validated RUnionEggOrder.SearchBody body) {
        Page<UnionEggOrder> result = repository.pageList(body);
        return AjaxResult.data(result);
    }


    @PostMapping(value = "replenishExpress")
    @ApiOperation(value = "订单发货")
    @SaCheckPermission("union:egg:order:replenishExpress")
    public AjaxResult<String> replenishExpress(@Validated @RequestBody RUnionEggOrder.ReplenishExpress body) {
        repository.replenishExpress(body);
        return AjaxResult.success();
    }


}
